<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="iwpl.project.dao.EquipmentsDAO"%>
<%@page import="iwpl.project.entities.Equipments"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<center>

	<html>
		<head>
			<base href="<%=basePath%>">

			<title>My JSP 'Template.jsp' starting page</title>

			<meta http-equiv="pragma" content="no-cache">
			<meta http-equiv="cache-control" content="no-cache">
			<meta http-equiv="expires" content="0">
			<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
			<meta http-equiv="description" content="This is my page">
			<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
			<style type="text/css">
.styleTemplate1 {
	width: 984px;
}
</style>
		</head>
		<link rel="stylesheet" href="css/datepicker.css" type="text/css" />
		<script type="text/javascript" src="js/datepicker.js"></script>
		<script src="js/jquery-Source.js"></script>
		<script type="text/javascript" src="js/jquery-Validation.js"></script>
		<script type="text/javascript">
	$(document).ready(function() {
		$("#commentForm").validate();
	});
</script>
		<script type="text/javascript">
	function doCancel() {
		location.href = "Manage_Equipment.jsp";
	}
</script>
		<body>
			<table cellpadding="0" cellspacing="0">
				<tr>
					<td>


						<form id="commentForm" method="post"
							action="./servlet/Control_Equipment" runat="server">
							<style type="text/css">
label.error {
	float: none;
	color: red;
	padding-left: .5em;
	vertical-align: top;
}
</style>
							<fieldset>
								<legend>
									Update Equipment
								</legend>
								<table class="style1">
									<tr>
										<td class="style2" colspan="5">
											<table cellpadding="2" class="style3">
												<tr>
													<%
														EquipmentsDAO dao = new EquipmentsDAO();
														int id = Integer.parseInt(request.getParameter("id"));
														Equipments equip = dao.findById(id);
														String date1 = equip.getMaintainDate().getMonth() + 1 + "-"
																+ equip.getMaintainDate().getDate() + "-"
																+ equip.getMaintainDate().toString().substring(0, 4);
														String date2 = equip.getProducDate().getMonth() + 1 + "-"
																+ equip.getProducDate().getDate() + "-"
																+ equip.getProducDate().toString().substring(0, 4);
														String date3 = equip.getEnpiratyDate().getMonth() + 1 + "-"
																+ equip.getEnpiratyDate().getDate() + "-"
																+ equip.getEnpiratyDate().toString().substring(0, 4);
													%>
													<td>
														<input type="hidden" name="id" value="<%=id%>">
														<label for="Equipment">
															Equipment Name
														</label>
													</td>
													<td>
														<input type="text" style="width: 196px" name="txtName"
															value="<%=equip.getEquipmentName()%>" class="required">
													</td>
												</tr>
												<tr>
													<td>
														<label for="Maintain">
															Maintain Date
														</label>
													</td>

													<td>
														<img height="21" width="26"
															src="./images/file_temporary.png"
															onclick="displayDatePicker('txtMaintain', this);"/>
														<input type="text" name="txtMaintain" value="<%=date1%>"
															id="Maintain" readonly="readonly" class="required"/>

													</td>
												</tr>
												<tr>
													<td>
														<label for="Product">
															Product Date
														</label>
													</td>

													<td>
														<img height="21" width="26"
															src="./images/file_temporary.png"
															onclick="displayDatePicker('txtProduct', this);"/>
														<input type="text" name="txtProduct" value="<%=date2%>"
															id="Product" readonly="readonly" class="required"/>

													</td>
												</tr>
												<tr>
													<td>
														<label for="Expiration">
															Expiration Date
														</label>
													</td>

													<td>
														<img height="21" width="26"
															src="./images/file_temporary.png"
															onclick=
	displayDatePicker('txtExpiration', this);;
>
														<input type="text" name="txtExpiration" value="<%=date3%>"
															id="Expiration" readonly="readonly" class="required">

													</td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td colspan="5">
											<table width="273" height="34">
												<tr>
													<td>
														<input type="hidden" name="action" value="update">
														<button name="btnInsert"
															style="width: 70px; height: 25px; margin-left: 0px; margin-right: 5px; text-align: center"
															type="submit" value="Insert" class="submit">
															Save
														</button>
													</td>
													<td>
														<button name="btnReset"
															style="width: 70px; height: 25px; margin-left: 0px; margin-right: 5px; text-align: center"
															type="reset" value="Reset" class="submit">
															Reset
														</button>
													</td>
													<td>

														<button name="btnCancel"
															style="width: 70px; height: 25px; text-align: center"
															onclick=
	doCancel();;
>
															Cancel
														</button>
													</td>
												</tr>
											</table>
										</td>
									</tr>

								</table>
							</fieldset>
						</form>
						<script type="text/javascript">
	function doCencel() {

	}
	function doInsert() {

	}
	function doClear() {
		txtName.Clear();
	}
</script>


					</td>
				</tr>
			</table>

		</body>
	</html>
</center>